<?php

class AdminMenuEnum extends MenuEnum
{
    private static $UdoLeftMenu = array();

    private static $UdoUserMenus = array(
        'Account'                                       => array(
            self::TYPE   => self::MENU_TYPE_LEFT,
            self::PARENT => 0,                          //顶级模块
            self::LABEL  => 'account',
            self::TITLE  => '员工管理',
            self::URL    => '/account/teacherList'
        ),
        'Classes'                                       => array(
            self::TYPE   => self::MENU_TYPE_LEFT,
            self::PARENT => 0,
            self::LABEL  => 'classes',
            self::TITLE  => '班级管理',
            self::URL    => '/classes/classesList',
        ),
        'Permission'                                    => array(
            self::TYPE  => self::MENU_TYPE_LEFT,
            self::PARENT => 0,
            self::LABEL => 'permission',
            self::TITLE  => '权限分配表',
            self::URL   => '/permission/permissionTable',
        ),
        'Exercise'                                      => array(
            self::TYPE => self::MENU_TYPE_LEFT,
            self::PARENT => 0,
            self::LABEL  => 'classes',
            self::TITLE  => '题库管理',
            self::URL  => '/exercise/subjectSetting',
        ),
        'Course'                                        => array(
            self::TYPE => self::MENU_TYPE_LEFT,
            self::PARENT => 0,
            self::LABEL  => 'course',
            self::TITLE  => '我的课程',
            self::URL  => '/course/scheduleVideo',
        ),
        'Learning'                                      => array(
            self::TYPE => self::MENU_TYPE_LEFT,
            self::PARENT => 0,
            self::LABEL  => 'learning',
            self::TITLE  => '学情查看',
            self::URL  => '/learning/learningStudentList',
        ),
        'Teaching'                                      => array(
            self::TYPE => self::MENU_TYPE_LEFT,
            self::PARENT => 0,
            self::LABEL  => 'teaching',
            self::TITLE  => '教学查看',
            self::URL  => '/teaching/teachingTeacherList',
        ),
        'Provost'                                      => array(
            self::TYPE => self::MENU_TYPE_LEFT,
            self::PARENT => 0,
            self::LABEL  => 'provost',
            self::TITLE  => '教务工作',
            self::URL  => '/provost/provostGroup',
        ),
        'Information'                                      => array(
            self::TYPE => self::MENU_TYPE_LEFT,
            self::PARENT => 0,
            self::LABEL  => 'information',
            self::TITLE  => '信息导入',
            self::URL  => '/information/classImport',
        )
    );

    private static $userMenus = array(
        //超级管理员
        AdminEnum::SUPPER_ADMIN_ROLE   => array(

             #管理员管理
            'ManageAdmin',                   //管理员管理
            'AddAdmin',                      //管理员添加
            'EditAdmin',                     //管理员编辑
            'AdminServiceAjax',              //管理员ajax

            #产品
            'ManageProject',                 //项目管理
            'DeleteManageProject',           //项目删除
            'AdminManageProjectAjax',        //项目ajax
            'ManageProjectModify',           //项目添加
            'AddManageProject',              //项目入库

            'CompanyList',                  //公司列表
            'CompanyAdd',                   //公司录入
            'CompanyEdit',                  //公司编辑
            'FCompanyList',                 //保理公司列表
            'FCompanyAdd',                  //保理公司录入
            'FCompanyEdit',                 //保理公司编辑



             #用户中心
            'ManageUser',                    //用户管理
            'AddUser',                       //用户添加
            'EditUser',                      //用户编辑
            'DeleteUser',                    //用户删除
            'UserServiceAjax',               //用户ajax

            'InvestRecord',                     //投标记录管理
            'DeleteInvestRecord',              //投资记录删除
            'AdminInvestRecordAjax',           //投资记录ajax

            'TicketRecord',                     //报票记录管理
            'DeleteTicketRecord',               //报票记录删除
            'AdminTicketRecordAjax' ,           //报票记录ajax

            'RechargeRecord',                    //充值记录管理
            'DeleteRechargeRecord',              //充值记录删除
            'AdminRechargeRecordAjax',           //充值记录ajax

            'WithdrawRecord',                     //体现记录管理
            'DeleteWithdrawRecord',               //体现记录删除
            'AdminWithdrawRecordAjax',             //体现记录ajax

            'BankManage',                         //用户银行管理
            'DeleteBankManage',                   //用户银行删除
            'AdminBankManageAjax',                //用户银行ajax



             #日志管理
            'LogService',                       //日志
            'DeleteLog',                        //日志删除
            'LogServiceAjax',                   //日志ajax

            # 广告位管理
            'AdsList',                          //广告列表
            'AddAds',                           //广告位添加
            'EditAds',                          //广告位编辑
            'DelAds',                           //广告位删除
            'AdsAjax',                          //ajax返回

             #资讯
            'NewsList',                         //资讯列表
            'NewsImport',                       //资讯添加
            'NewsEdit',                         //资讯编辑
            'NewsDel',                          //资讯删除
            'NewsAjax',                         //ajax返回


            #合作伙伴
            'PartnerList',                      //合作伙伴列表
            'PartnerAdd',                       //合作伙伴添加
            'PartnerEdit',                      //合作伙伴编辑
            'PartnerDel',                       //合作伙伴删除
            'PartnerAjax',                      //ajax返回

             #团队
            'TeamList',                          //团队列表
            'TeamAdd',                           //团队添加
            'TeamEdit',                          //团队编辑
            'TeamDel',                           //团队删除
            'TeamAjax',                          //ajax返回

             #招聘
            'RecruitList',                       //招聘列表
            'RecruitAdd',                        //招聘添加
            'RecruitEdit',                       //招聘编辑
            'RecruitDel',                        //招聘删除
            'RecruitAjax',                       //ajax返回


            //——————————————商城————————————————

            #产品
            'ProductList',                       //产品列表
            'ProductAdd',                        //产品添加
            'ProductEdit',                       //产品编辑

            #商家
            'BusinessList',                       //商家列表
            'BusinessAdd',                        //商家添加
            'BusinessEdit',                       //商家编辑


            'CategoryList',                       //分类列表
            'AddCategory',                        //添加分类
            'AjaxAddCategory',                   //添加动作
            'AjaxupdateCategory',                //修改动作
            'DelectCategory',                    //删除动作
            'Specificate',                       //规格列表
            'AddSpecificate',                   //添加规格
            'AjaxAddSpecificate',               //添加规格
            'AjaxupSpecificate',               //修改规格
            'DelectSpecificate',               //删除规格

            'BrandList',
            'BrandAdd',
            'BrandEdit',
            'BrandDel',
            'BrandDelAjax',

    ),
);

    public static function getUdoMenus()
    {
        return self::$UdoUserMenus;
    }

    public static function getUserMenus($role_id)
    {
        return self::$userMenus[$role_id];
    }

    public static function getLeftMenu($right)
    {

        self::mkNewMenus(self::getUdoMenus());
        $rightMenus = self::getUserMenus($right);

        $aLeftMenus = array();
        foreach ($rightMenus as $menu) {
            if (self::$UdoUserMenus[$menu][self::TYPE] == self::MENU_TYPE_LEFT)
                $aLeftMenus[] = $menu;
        }

        self::$UdoLeftMenu = self::setMenus($aLeftMenus);

        return self::$UdoLeftMenu;
    }

    public static function getLeftLeafMenu()
    {
        $action = self::getCurrentAction();
        self::getRootParent($action);
        $aLeftMenu = self::$UdoLeftMenu[self::$rootParent];
        $aLeafMenu = array();
        if (array_key_exists(self::LEAF, $aLeftMenu)) {
            foreach ($aLeftMenu[self::LEAF] as $leaf) {
                $leaf['label']                   = Lang::get('system.' . $leaf['label']);
                $aLeafMenu[$leaf[self::GROUP]][] = $leaf;
            }
        }

        return $aLeafMenu;
    }

    public static function getRightMenu($right)
    {
        self::mkNewMenus(self::getUdoMenus());
        $rightMenus  = self::getUserMenus($right);
        $aRightMenus = array();
        foreach ($rightMenus as $menu) {
            if (self::$UdoUserMenus[$menu][self::TYPE] == self::MENU_TYPE_RIGHT)
                $aRightMenus[] = $menu;
        }

        return self::setMenus($aRightMenus);
    }

    public static function getTopMenu($right)
    {
        self::mkNewMenus(self::getUdoMenus());
        $rightMenus = self::getUserMenus($right);
        $aTopMenus  = array();
        foreach ($rightMenus as $menu) {
            if (self::$UdoUserMenus[$menu][self::TYPE] == self::MENU_TYPE_TOP)
                $aTopMenus[] = $menu;
        }

        return self::setMenus($aTopMenus);
    }

    public static function getButtonMenu($right)
    {
        self::mkNewMenus(self::getUdoMenus());
        $rightMenus = self::getUserMenus($right);
        $aButMenus  = array();
        foreach ($rightMenus as $menu) {
            if (self::$UdoUserMenus[$menu][self::TYPE] == self::MENU_TYPE_BUTTON)
                $aButMenus[] = $menu;
        }

        return self::setMenus($aButMenus);
    }
}